#ifndef MEMSTORAGE_EXCEPTIONS_HPP_
#define MEMSTORAGE_EXCEPTIONS_HPP_

class MemAllocException : public std::exception {
	public:

	enum ErrorCode { 
		E_NOMEM, /*!< Not enough memory to load memory region from swap */
		E_NOBUFS, /*!< Too fragmented RAM */
		E_2BIG, /*!< Requested memory region is too big for allocator */
		E_MLINK, /*!< Lack of free memory identifiers */
		E_ALREADY, /*!< Allocator has already been initialized */
		E_INVALID_INIT_SIZES, /*!< Swap area is smaller than mem area */
		E_ACTIVE_MEMORY_FREE, /*!< Someone tried to Free memory which 
		                          is currently in use */
		E_INVALID_MEM,
		E_ALREADY_RELEASED,
		E_BADF,
		E_INVAL
	};
	const std::string error_msg_;
	ErrorCode error_code_;

	MemAllocException() = delete;
	MemAllocException(ErrorCode error_code, const std::string& error_msg = std::string())
		:error_msg_(error_msg), error_code_(error_code) {}

	const char* what() const noexcept { return error_msg_.c_str(); };
	ErrorCode GetErrorCode() const noexcept { return error_code_; }; 
};


#endif //MEMSTORAGE_EXCEPTIONS_HPP_
